package cn.map.tools;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class CollectionsDemo {
    public static void main(String[] args) {
        List<String> list = new ArrayList<String>();
        Collections.addAll(list,"a","b","c","d");
        System.out.println(list);
        // 二分查找 (前提: 必须是排好序的数据)
        System.out.println(Collections.binarySearch(list,"b"));
        // 洗牌
        Collections.shuffle(list);
        System.out.println(list);

        ArrayList<Student> nums = new ArrayList<>();
        Collections.addAll(nums, new Student("张三", 23), new Student("王五", 25), new Student("李四", 24));
        System.out.println(nums);
    }
}
